All Questions
Tagged with nested-loopspython
1,294 questions
1vote
1answer
50views
Finding Numerical Relationships between Columns
I have selected a subset of numerical columns from a database and I want to iterate through the columns selecting a target_column and comparing it with the result of a numerical operation between two ...
0votes
1answer
42views
Approaches To Optimize Nested For Loops and Dataframe Creation?
I am not very experienced with coding but I am creating a customtkinter application style script where a user can input a specific type of html that contains diagnostic addresses and various ...
2votes
1answer
99views
Is there a smart way to vectorize a nested for-loop where the inner index is limited by the outer index?
Is there a smart way to vectorize a nested for loop of inner products, where the inner index is lower bound by the outer index? Here's a simple example. Say that arr1 and arr2 are numpy arrays each ...
0votes
1answer
40views
What is the difference between writing in one and two lines when transporting a matrix? [closed]
If the replacement of elements is written in two lines, then the matrix is transported incorrectly x=[[i for i in list(map(int,input().split()))] for _ in range(int(input()))] print("Result:...
0votes
0answers
146views
How can I optimize Elliott Wave detection in large cryptocurrency datasets?
I am working on a Python program that identifies Elliott Wave patterns in cryptocurrency market data. The current implementation uses nested loops and exhaustive searches, which makes it ...
0votes
0answers
68views
How can I print all possible x-letter words in python using loops? [duplicate]
How can I print all possible words of a user-specified length "x" in python? I already know how to do it for a specific number of characters like all possible 3 letter words by using for ...
0votes
3answers
110views
The best way to reduce the calculation time of formulas in nested loops?
Could you tell me what is the best way to reduce the calculation time of formulas in nested loops? I have code like this: for k in range(0, 130): for i in range(0, 1600): array2[i,k] = 0 ...
2votes
2answers
67views
Why this nested loop generator does not seem to be working?
I was trying this: tuple(map(tuple, tuple(((x,y) for x in range(5)) for y in range(3)))) I got this: (((0, 2), (1, 2), (2, 2), (3, 2), (4, 2)), ((0, 2), (1, 2), (2, 2), (3, 2), (4, 2)), ((0, 2), (1,...
0votes
1answer
54views
How to speed up the passage of a nested loop in Python
How to speed up the passage of a nested loop. I am doing browser automation using Selenium and in one section of the code I need to compare coefficients and dates with table cells. The code needs ...
0votes
0answers
51views
How would I go about creating a loop that tests variables in sequence to determine the source of the entry?
In creating a user form application where I enter in customer information, I want to have the information I type into the Entry boxes do two things: 1) Update in real time to a label off to the side ...
0votes
1answer
66views
Reducing length with a loop
I have a class which has a series of loops inside of it. Each loop uses a pandas.dataframe to add data to a new list that can be called as an instance attribute. data = [player_stats, ...
2votes
1answer
104views
how to pandas fast nested for loop for "non numeric" columns?
how to pandas fast nested for loop for "non numeric" columns? because this for loop is way to slow: for i in range(len(df1[column_A]): for j in range(len(df2[column_A]): if df1[...
-2votes
1answer
92views
How to Convert Nested for Loops with Multiple Internal Loops into map() Function? [closed]
I was trying to speed up some nested for loops with multiple internal loops in python 3.11: for item1 in iterable1: for item2 in interable2: if condition == true: expression1 ...
0votes
1answer
139views
Use vectorised functions instead of the loops
My function is such that it takes the minimum over the range of dataframe which keeps increasing in length and maximum over the dataframe which reduces in length with each iteration. The dataframe ...
0votes
0answers
61views
Flatting out multiple nested dictionary into a dataframe for use in data modeling
I am slowly working through different python courses to teach myself Python. After taking courses for ~ a month I started to work on building a model using a data API feed from DataGolf. The data is ...